<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<script src="../js/global.js" type="text/javascript" charset="utf-8"></script>
	</head>

	<body>
		<form class="layui-form" action="" id="userForm">
			<div class="layui-form-item">
				<label class="layui-form-label">角色名:</label>
				<div class="layui-input-inline">
					<input type="text" name="loginName" required lay-verify="required" placeholder="请输入角色名" autocomplete="off" class="layui-input">
				</div>
			</div>
			</div>
			</div>
			<div class="layui-form-item">
				<div class="layui-input-block">
					<button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
					<button type="reset" class="layui-btn layui-btn-primary">重置</button>
				</div>
			</div>
		</form>
	</body>
	<script type="text/javascript">
		layui.use(["layer", "form"], function() {
			var layer = layui.layer;
			var form = layui.form;
			var $ = layui.$;
			form.on("submit(formDemo)", function() {
				var str = $("#userForm").serialize() + "&token=" + golbalDate.myToken;
				$.post(golbalDate.server + "CreateUser", str, function(res) {
					if(res.success) {
						layer.open({
							type: 1,
							content: "addUser.html",
							area: ["150", "150"]

						});
					} else {
						alert("添加失败");
					}
				}, "josn");
				return false;
			});
		});
	</script>

</html>